package com.example.microinvestcommon.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@AllArgsConstructor
@NoArgsConstructor
@Data
/**
 * @author tianwailaiwu
 * 用于显示15分时K图的ViewObject
 */
public class StockOneFiveMinDataVo {
    private String stockSymbol;
    private List<Double> stockOneFiveMinData;

    public StockOneFiveMinDataVo(String stockSymbol,String stockData){

        stockData =stockData.substring(1, stockData.length() - 1);

        List<Double> doubleList = Arrays.stream(stockData.split(",\\s*"))
                .map(Double::parseDouble)
                .collect(Collectors.toList());

        this.stockSymbol=stockSymbol;
        this.stockOneFiveMinData=doubleList;

    }
}
